package com.cheer.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cheer.dao.OaAdminRoleDao;
import com.cheer.entity.OaAdminRoleEntity;
import com.cheer.service.OaAdminRoleService;
import com.cheer.vo.SimpleObjectVO;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service("oaAdminRoleService")
public class OaAdminRoleServiceImpl extends ServiceImpl<OaAdminRoleDao, OaAdminRoleEntity> implements OaAdminRoleService {

    @Override
    public List<SimpleObjectVO> listSimple() {
        List<OaAdminRoleEntity> adminRoleList = list();

        return adminRoleList.stream()
                .map(oaAdminRoleEntity -> new SimpleObjectVO()
                        .setId((long) oaAdminRoleEntity.getId())
                        .setName(oaAdminRoleEntity.getTitle()))
                .collect(Collectors.toList());
    }
}